From: Keir Fraser Date: Tue, 4 Dec 2007 10:41:55 +0000 (+0000) Subject: xend: Implement get_by_name_label for class XendNetwork X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14683^2~4 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a914d49745ea205b705ff7b07c47b7239072642b;p=xen.git xend: Implement get_by_name_label for class XendNetwork Although XenAPI c-bindings support this operation on Network class, there is no implementation in xend. This patch provides one. Signed-off-by: Jim Fehlig --- diff --git a/tools/python/xen/xend/XendNetwork.py b/tools/python/xen/xend/XendNetwork.py index 1858fbfbb0..d04584d3ad 100644 --- a/tools/python/xen/xend/XendNetwork.py +++ b/tools/python/xen/xend/XendNetwork.py @@ -65,7 +65,7 @@ class XendNetwork(XendBase): return XendBase.getMethods() + methods def getFuncs(self): - funcs = ['create'] + funcs = ['create', 'get_by_name_label'] return XendBase.getFuncs() + funcs getClass = classmethod(getClass) @@ -133,9 +133,15 @@ class XendNetwork(XendBase): return uuid - create_phy = classmethod(create_phy) - recreate = classmethod(recreate) - create = classmethod(create) + def get_by_name_label(cls, name): + return [inst.get_uuid() + for inst in XendAPIStore.get_all(cls.getClass()) + if inst.get_name_label() == name] + + create_phy = classmethod(create_phy) + recreate = classmethod(recreate) + create = classmethod(create) + get_by_name_label = classmethod(get_by_name_label) def __init__(self, record, uuid): XendBase.__init__(self, uuid, record)